import tkinter as tk
from tkinter import ttk
from data import db

class AboutFrame(tk.Frame):
    def __init__(self,root):
        super().__init__(root)

        tk.Label(self, text='关于作品：tkinter制作').pack()
        tk.Label(self, text='关于作者：张坤杰 制作').pack()


class ChangeFrame(tk.Frame):
    def __init__(self,root):
        super().__init__(root)

        tk.Label(self, text='这是修改页面').pack()


class InsertFrame(tk.Frame):
    def __init__(self,root):
        super().__init__(root)

        tk.Label(self, text='这是插入页面').pack()



class DeleteFrame(tk.Frame):
    def __init__(self,root):
        super().__init__(root)

        tk.Label(self, text='这是删除页面').pack()

class SearchFrame(tk.Frame):
    def __init__(self,root):
        super().__init__(root)
        self.tabble_view=tk.Frame()
        self.tabble_view.pack()
        self.create_page()

    def create_page(self):
        columns=('name','chinese','math','english')
        columns_values = ('姓名', '语文', '数学', '英语')
        self.tree_view=ttk.Treeview(self,show='headings',columns=columns)
        self.tree_view.column('name',width=80,anchor='center')
        self.tree_view.column('chinese', width=80, anchor='center')
        self.tree_view.column('math', width=80, anchor='center')
        self.tree_view.column('english', width=80, anchor='center')
        self.tree_view.heading('name', text='姓名')
        self.tree_view.heading('chinese', text='语文')
        self.tree_view.heading('math', text='数学')
        self.tree_view.heading('english', text='英语')
        self.tree_view.pack(fill=tk.BOTH,expand=True)
        self.show_data_frame()

    def show_data_frame(self):
        students = db.all()
        index = 0
        for stu in students:
            print(stu)


